using System;
using System.Windows.Markup;
using WPFTemplateLib.WpfHelpers;

namespace WPFTemplateLib.MarkupExtensions
{
	#region 整型

	/// <summary>
	/// [标记扩展] 提供 byte 值
	/// </summary>
	public class ByteValue : MarkupExtension
	{
		public byte Value { get; set; }

		public override object ProvideValue(IServiceProvider serviceProvider)
		{
			return Value;
		}
	}

	/// <summary>
	/// [标记扩展] 提供 short 值
	/// </summary>
	public class ShortValue : MarkupExtension
	{
		public short Value { get; set; }

		public override object ProvideValue(IServiceProvider serviceProvider)
		{
			return Value;
		}
	}

	/// <summary>
	/// [标记扩展] 提供 int 值
	/// </summary>
	public class IntValue : MarkupExtension
	{
		public int Value { get; set; }

		public override object ProvideValue(IServiceProvider serviceProvider)
		{
			return Value;
		}
	}

	/// <summary>
	/// [标记扩展] 提供 long 值
	/// </summary>
	public class LongValue : MarkupExtension
	{
		public long Value { get; set; }

		public override object ProvideValue(IServiceProvider serviceProvider)
		{
			return Value;
		}
	}

	#endregion

	#region 浮点型

	/// <summary>
	/// [标记扩展] 提供 float 值
	/// </summary>
	public class FloatValue : MarkupExtension
	{
		public float Value { get; set; }

		public override object ProvideValue(IServiceProvider serviceProvider)
		{
			return Value;
		}
	}

	/// <summary>
	/// [标记扩展] 提供 double 值
	/// </summary>
	public class DoubleValue : MarkupExtension
	{
		public double Value { get; set; }

		public override object ProvideValue(IServiceProvider serviceProvider)
		{
			return Value;
		}
	}

	/// <summary>
	/// [标记扩展] 提供 decimal 值
	/// </summary>
	public class DecimalValue : MarkupExtension
	{
		public decimal Value { get; set; }

		public override object ProvideValue(IServiceProvider serviceProvider)
		{
			return Value;
		}
	}

	#endregion

	#region 其它

	/// <summary>
	/// [标记扩展] 提供 char 值
	/// </summary>
	public class CharValue : MarkupExtension
	{
		public char Value { get; set; }

		public override object ProvideValue(IServiceProvider serviceProvider)
		{
			return Value;
		}
	}

	/// <summary>
	/// [标记扩展] 提供 bool 值
	/// </summary>
	public class BoolValue : MarkupExtension
	{
		public bool Value { get; set; }

		public override object ProvideValue(IServiceProvider serviceProvider)
		{
			return Value;
		}
	}

	/// <summary>
	/// [标记扩展] 提供 SolidColorBrush 值
	/// </summary>
	public class SolidColorBrushValue : MarkupExtension
	{
		/// <summary>
		/// 颜色字符串（支持 RGB 和 ARGB 形式）
		/// </summary>
		public string ColorStr { get; set; }

		public override object ProvideValue(IServiceProvider serviceProvider)
		{
			return MediaColorHelper.ColorStrToSolidColorBrush(ColorStr);
		}
	}

	#endregion
}
